// NycMap.cpp : implementation file
//

#include "stdafx.h"
#include "MapMaker.h"
#include "NycMap.h"

// CNycMap

IMPLEMENT_DYNAMIC(CNycMap, CStatic)

CNycMap::CNycMap(CNodePtrVec* nodes)
{
    m_nodes = nodes;
}

CNycMap::~CNycMap()
{
}


BEGIN_MESSAGE_MAP(CNycMap, CStatic)
    ON_WM_PAINT()    
END_MESSAGE_MAP()

// CNycMap message handlers
void CNycMap::OnPaint()
{
	// Get device context 
    CPaintDC dc(this);
	CDC* mdc = new CDC();
	mdc->CreateCompatibleDC(&dc);

	// Get bitmap rect	
    CRect rect;
    GetClientRect(&rect);

	// Draw BMP of NYC
	CBitmap bmp;
	bmp.LoadBitmap(IDB_NYC);
	mdc->SelectObject(&bmp);
	dc.BitBlt(0, 0, rect.Width(), rect.Height(), mdc, 0, 0, SRCCOPY);

    // Draw node map
    for (CNodePtrVecIter it = m_nodes->begin(); it != m_nodes->end(); ++it)
    {
        (*it)->Paint(dc);
    }

    delete mdc;
}
